#pragma once

#include "RigidBody.h"

#pragma once

#include "RigidBody.h"

namespace mphys
{
	class Box : public RigidBody
	{
	public:
		float HalfSizeX, HalfSizeY, HalfSizeZ;
		XMFLOAT3 Axes[3]; // principal axes in world coords

		virtual void reset(const RigidBodyDesc & desc);
		void updateBoxData();

		virtual float checkRayIntersection(const mmath::Ray & ray);

		virtual RigidBody & copy();

	private:
		float mFaceOffsetFromOrigin[6];
	};

	class Sphere : public RigidBody
	{
	public:
		float Radius;

		virtual void reset(const RigidBodyDesc & desc);

		virtual float checkRayIntersection(const mmath::Ray & ray);

		virtual RigidBody & copy();
	};

	class Plane : public RigidBody
	{
	public:
		XMFLOAT3 Normal;
		float Offset;

		virtual void reset(const RigidBodyDesc & desc);
		void updatePlaneData(); // should also be called from physics system, if plane is dynamic (currently only static planes allowed)

		virtual float checkRayIntersection(const mmath::Ray & ray);

		virtual RigidBody & copy();
	};
}